package Lecture6;

import java.util.Scanner;

public class ClassTask5 {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		
		System.out.println("Enter two words that you want to check if they are anagrams!");
		String word = sc.nextLine();
		
		String word1 = sc.nextLine();
		
		boolean result = false;
		if (word.length() != word1.length())
		{
			result = false;
		}
		
		for(int i = 0; i < word.length(); i++)
		{
			for(int j = 0; j < word.length(); j++)
			{
				
			if(word.charAt(i) == word1.charAt(j))
			{
				
				result = true; break;
			}
			else { result = false; }
			
			}
			if (result == false)
			{
			  System.out.println("The words are NOT anagrams");	break;
			}
		}
		
		if(result == true)
		{
			System.out.println("The word are anagrams");
		}

}
}
